package cn.memset.sample;

import cn.memset.sample.classloaders.MyCommonClassLoader;
import cn.memset.service.api.Service;

/**
 * 类加载器“传递性”的示例代码
 */
public class ClassLoaderTransTest {
    private final static String COMMON_PATH = "E:\\Work\\Workspace\\JavaCode\\Demo\\java-classloader-sample\\app-service\\target\\classes";

    public static void main(String[] args) throws Exception {
        ClassLoader myLoader = new MyCommonClassLoader(COMMON_PATH);
        Class<?> serviceCls = Class.forName(
                "cn.memset.app.CompanyService",
                false,
                myLoader);

        Service service = (Service) serviceCls.newInstance();
        service.start();
    }
}
